package com.halflife.nio;

import java.io.*;
import java.net.InetSocketAddress;
import java.net.Socket;

public class SocketIOClient {
    public static void main(String[] args) throws IOException, InterruptedException {
        Socket socket = new Socket();
        socket.connect(new InetSocketAddress("192.168.31.129", 9090));
//        PrintStream ps=new PrintStream(socket.getOutputStream());
        OutputStream os = socket.getOutputStream();
        long i = 0l;
        String abc = "aaaaaaaaaaaaaaaaaaaaa";
        for (int j = 0; j < 1000; j++) {
            abc = abc + "aaaaaaaaaaaaaaaaaaaaa";
        }
        abc += "bbbbbbbbbbbbbbbbbbbbbbbb";
        System.out.println(abc);
        while (true) {
            os.write(abc.getBytes("UTF-8"));
            System.out.println(i);
            os.flush();
            Thread.currentThread().sleep(1*3000);
        }
    }
}
